<?php
class Keyword extends AppModel {

	var $name = 'Keyword';
        var $virtualFields = array(
             'total_hits' => 'SELECT SUM(keyword_hit_logs.hit_count) FROM keyword_hit_logs WHERE keyword_hit_logs.keyword_id = Keyword.id'
        );

	var $validate = array(
		'website_id' => array('numeric'),
		'keyword' => array('notempty'),
		'destination_url' => array('notempty')
	);

	//The Associations below have been created with all possible keys, those that are not needed can be removed
	var $belongsTo = array(
		'Website' => array(
			'className' => 'Website',
			'foreignKey' => 'website_id',
			'conditions' => '',
			'fields' => '',
			'order' => ''
		)
	);

	var $hasMany = array(
		'KeywordHitLog' => array(
			'className' => 'KeywordHitLog',
			'foreignKey' => 'keyword_id',
			'dependent' => false,
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'exclusive' => '',
			'finderQuery' => '',
			'counterQuery' => ''
		)
	);

}
?>